﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleData.Data;
using System.Data.Objects;
using System.Linq.Expressions;

namespace SimpleData
{
	public static class DataGenExtensions
	{

		public static DGen Generate( this Runtime runtime )
		{
			return new DGen( runtime );
		}


		public static TValue Get<TValue>( this DataGenEntityBuilder<TValue> builder )
			where TValue : class
		{
			return builder.Entity;
		}

		public static ObjectContext NewRepository( this DGen dgen )
		{
			return new DataAccess.SqlClient.DataObjectContext();
		}

		public static DataGenEntityBuilder<TEntity> Properties<TEntity>( this DataGenEntityBuilder<TEntity> builder, Action<TEntity> setup )
			where TEntity : class
		{
			if ( setup != null )
				setup( builder.Entity );
			return builder;
		}
	}


	
}
